home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2003 September / PC Answers September 2003.iso / Software / trial / MonitorIT 5.2.06 / monitorit_fullsetup.exe / data1.cab / Js / MiscFunc.js < prev    next >
Encoding:
JavaScript  |  2003-06-24  |  2.0 KB  |  65 lines

  1. /* ======================================================================
  2. DESC: Common Miscellaneous Functions for the Administer Operations
  3.  
  4. PLATFORMS: >= MS IE 4.0
  5. USAGE NOTES: 
  6. ====================================================================== */
  7. var   OSNameArray = new Array("4.0.1","95","4.90.","98","dows 95","95","dows 98","98","dows -95","95","dows -98","98","NT Work~4.","NTWS4","NT Server~4.","NTS4","NT Work~5.","NTWS5","NT Server~5.","NTS5");
  8.  
  9. /* Add an <Option> entry with the text to the specified <Select> */
  10. function addElementToSelect(SelectObj,text) {
  11.     var el = document.createElement("OPTION");
  12.     el.text = text;
  13.     SelectObj.options.add(el);
  14.     return el;
  15. }
  16.  
  17. /* if Key is ENTER change to TAB */
  18. function processKeyDown() { 
  19.     if (event.keyCode == 13) 
  20.         event.keyCode = 9
  21. }
  22. function processBSP() { // if Backspace and not editing, chnage to space to avoid navagating away
  23.     if ( !(event.srcElement.type == "text" && event.srcElement.className != "idis") && event.keyCode == 8) 
  24.         event.keyCode = 32
  25. }
  26.  
  27. /* Ckeck if object is disabled */
  28. function chkDisabled(Ckobj) {
  29.     if ( top.MainLoaded == false || Ckobj.className == "idis" ) {
  30.         if ( Ckobj.readOnly == false ) {
  31.             Ckobj.readOnly = true;
  32.             Ckobj.blur();    
  33.         }    
  34.         return true; // Yes
  35.     }
  36.     Ckobj.readOnly = false;
  37.     return false; // No
  38. }
  39.  
  40. function SetCursor(ctyp) {
  41.     document.body.style.cursor=ctyp;
  42. }
  43.  
  44. /* Map OSVer to name used by SA record */
  45. function mapOSVer(OSV) {
  46.     var j=0;
  47.     var KeyArr = new Array();
  48.     for ( var i=0; i<OSNameArray.length; i+=2 ) {
  49.         KeyArr = OSNameArray[i].split("~");
  50.         for ( j=0; j<KeyArr.length; j++ ) {
  51.              if ( OSV.indexOf(KeyArr[j]) < 0 ) // Find ID key in OS string
  52.                 break; // if no match
  53.         }
  54.         if ( j>=KeyArr.length ) // Break again if ID key match on all substrings
  55.             break;
  56.     }
  57.     if ( i<OSNameArray.length ) { // if key found, use SA's name
  58.         OSV = OSNameArray[i+1];
  59.     }
  60.     else { // otherwise, treat as unknown
  61.         OSV = "Unknown";
  62.     }
  63.     return OSV;
  64. }
  65.